function UtilitiesObject(theGame){
	var game = theGame;
	this.headingToRadians = function (heading){
		var degrees = 90-heading;
		return degrees * Math.PI / 180;
	};
	this.radiansToHeading = function (radians){
		var degrees = radians * 180 / Math.PI;
		degrees = 90 - degrees;
		while(degrees<0) degrees+= 360;
		while(degrees>360) degrees-=360;
		return degrees;
	};
	this.speedAndHeadingToLocation = function(speed,heading){
		var location = new LocationObject();
		location.setRadius(speed);
		location.setTheta(this.headingToRadians(heading));
		return location;
	};
	var DMSObject = function(heading,roundSeconds){
		if(roundSeconds==null) roundSeconds = false;
		var degrees = Math.floor(heading);
		heading -= degrees;
		while(degrees<0){
			degrees += game.getConfig().getDegreesPerCircle()
		}
		while(degrees>=game.getConfig().getDegreesPerCircle()){
			degrees -= game.getConfig().getDegreesPerCircle()
		}
		heading *= game.getConfig().getMinutesPerDegree();
		var minutes = Math.floor(heading);
		heading -= minutes;
		heading *= game.getConfig().getSecondsPerMinute();
		var seconds = (roundSeconds)?(Math.round(heading)):(heading);
		this.getDegrees = function(){return degrees;};
		this.getMinutes = function(){return minutes;};
		this.getSeconds = function(){return seconds;};
		this.toString = function(){
			return degrees + "&deg; " + minutes + "' " + seconds + "\"";
		};
	}
	this.headingToDMS = function(heading,roundSeconds){
		return new DMSObject(heading,roundSeconds);
	};
	this.roundByFactor = function(price,roundingFactor){
		return Math.round(roundingFactor * price)/roundingFactor;
	};
	this.getRandomInt = function(min,max){
		return Math.floor(Math.random()*(max-min+1)+min);
	};
	this.getRandomBoolean = function(){
		return Math.random()<0.5;
	};
	this.getRandomFloat = function(min,max){
		return Math.random()*(max-min)+min;
	};
	this.getRandomArrayElement = function (theArray){
		return theArray[this.getRandomInt(0,theArray.length-1)];
	};
}
